package com.zhang.units;

import lombok.Builder;
import lombok.Data;

/**
 * @author Dong
 */
@Builder
@Data
public class Result {

    private int code;

    private String message;

    private Object data;

    public static Result resultFail(String message){
        return Result.builder()
                .code(-1)
                .message(message)
                .build();
    }

    public static Result result200(Object data){
        return Result.builder()
                .code(200)
                .message("获取成功!")
                .data(data)
                .build();
    }

    public static Result result200(Object data,int sum ){
        return Result.builder()
                .code(sum)
                .message("获取成功!")
                .data(data)
                .build();
    }

    public static Result result200(){
        return Result.builder()
                .code(200)
                .message("获取成功!")
                .build();
    }

    public static Result result400(){
        return Result.builder()
                .code(400)
                .message("参数错误!")
                .build();
    }

    public static Result result500(String message){
        return Result.builder()
                .code(500)
                .message(message)
                .build();
    }


}
